import Swal from 'sweetalert2'

const Toast = Swal.mixin({
    toast: true,
    position: 'center',
    showConfirmButton: false,
    timer: 2000,
    timerProgressBar: false,
    didOpen: (toast) => {
        toast.addEventListener('mouseenter', Swal.stopTimer)
        toast.addEventListener('mouseleave', Swal.resumeTimer)
    }
})
export default {
    success: function (message) {
        Toast.fire({
            position: 'top',
            icon: 'success',
            title: message,
            showConfirmButton: false,
            timer: 1500
        })
    },
    warning: function (message) {
        Toast.fire({
            position: 'top',
            icon: 'warning',
            title: message,
            showConfirmButton: false,
            timer: 1500
        })
    },
    error: function (message) {
        Toast.fire({
            position: 'top',
            icon: 'error',
            title: message,
            showConfirmButton: false,
            timer: 1500
        })
    },
}